package com.jlpay.openapi.demo.openmerch.device;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.request.UnionPayCodeQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.response.UnionPayCodeQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author liaochangyi
 * @since 2025/06/30
 **/
public class UnionpayQueryService {

    private static final Logger LOGGER = LoggerFactory.getLogger(UnionpayQueryService.class);

    public static void main(String[] args) {
        UnionPayCodeQueryRequest unionPayCodeQueryRequest = buildUnionPayCodeQueryRequest();
        UnionPayCodeQueryResponse unionPayCodeQueryResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(unionPayCodeQueryRequest, UnionPayCodeQueryResponse.class);
        LOGGER.info("银联原生码加机响应:{}", JsonUtils.toString(unionPayCodeQueryResponse));
    }

    private static UnionPayCodeQueryRequest buildUnionPayCodeQueryRequest(){
        UnionPayCodeQueryRequest unionPayCodeQueryRequest = new UnionPayCodeQueryRequest();

        unionPayCodeQueryRequest.setMerchNo("84940535193A006");

        return unionPayCodeQueryRequest;
    }

}
